﻿using System;
using System.Web;

namespace MvcSecurityLogging
{
    #region Membership

    class MembershipException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal MembershipException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Membership;
        }

        internal MembershipException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Membership;
        }
    }

    class CreateUserException : MembershipException
    {
        internal CreateUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUser;
        }

        internal CreateUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUser;
        }
    }

    class ErrorCreateUserException : MembershipException
    {
        internal ErrorCreateUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUser;
        }

        internal ErrorCreateUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUser;
        }
    }

    class ChangePasswordException : MembershipException
    {
        internal ChangePasswordException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ChangePassword;
        }

        internal ChangePasswordException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ChangePassword;
        }
    }

    class ErrorChangePasswordException : MembershipException
    {
        internal ErrorChangePasswordException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorChangePassword;
        }

        internal ErrorChangePasswordException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorChangePassword;
        }
    }

    class LockUserException : MembershipException
    {
        internal LockUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.LockUser;
        }

        internal LockUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.LockUser;
        }
    }

    class ErrorLockUserException : MembershipException
    {
        internal ErrorLockUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorLockUser;
        }

        internal ErrorLockUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorLockUser;
        }
    }

    class UnLockUserException : MembershipException
    {
        internal UnLockUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UnLockUser;
        }

        internal UnLockUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UnLockUser;
        }
    }

    class ErrorUnLockUserException : MembershipException
    {
        internal ErrorUnLockUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUnLockUser;
        }

        internal ErrorUnLockUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUnLockUser;
        }
    }

    class DeleteUserException : MembershipException
    {
        internal DeleteUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUser;
        }

        internal DeleteUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUser;
        }
    }

    class ErrorDeleteUserException : MembershipException
    {
        internal ErrorDeleteUserException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUser;
        }

        internal ErrorDeleteUserException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUser;
        }
    }

    #endregion

    #region Authentication

    class AuthenticationException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal AuthenticationException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Authentication;
        }

        internal AuthenticationException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Authentication;
        }
    }

    class LoginException : AuthenticationException
    {
        internal LoginException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Login;
        }

        internal LoginException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Login;
        }
    }

    class ErrorLoginException : AuthenticationException
    {
        internal ErrorLoginException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorLogin;
        }

        internal ErrorLoginException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorLogin;
        }
    }

    class LogoutException : AuthenticationException
    {
        internal LogoutException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Logout;
        }

        internal LogoutException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Logout;
        }
    }

    #endregion

    #region Authorization

    class AuthorizationException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal AuthorizationException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Authorization;
        }

        internal AuthorizationException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Authorization;
        }
    }

    class AuthorizedAccessException : AuthorizationException
    {
        internal AuthorizedAccessException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.AuthorizedAccess;
        }

        internal AuthorizedAccessException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.AuthorizedAccess;
        }
    }

    class UnAuthorizedAccessAttemptException : AuthorizationException
    {
        internal UnAuthorizedAccessAttemptException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UnAuthorizedAccessAttempt;
        }

        internal UnAuthorizedAccessAttemptException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UnAuthorizedAccessAttempt;
        }
    }

    #endregion

    #region EntityManipulation

    class EntityManipulationException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal EntityManipulationException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.EntityManipulation;
        }

        internal EntityManipulationException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.EntityManipulation;
        }
    }

    class CreateEntityException : EntityManipulationException
    {
        internal CreateEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateEntity;
        }

        internal CreateEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateEntity;
        }
    }

    class ErrorCreateEntityException : EntityManipulationException
    {
        internal ErrorCreateEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateEntity;
        }

        internal ErrorCreateEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateEntity;
        }
    }

    class ReadEntityException : EntityManipulationException
    {
        internal ReadEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ReadEntity;
        }

        internal ReadEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ReadEntity;
        }
    }

    class ErrorReadEntityException : EntityManipulationException
    {
        internal ErrorReadEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorReadEntity;
        }

        internal ErrorReadEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorReadEntity;
        }
    }

    class UpdateEntityException : EntityManipulationException
    {
        internal UpdateEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateEntity;
        }

        internal UpdateEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateEntity;
        }
    }

    class ErrorUpdateEntityException : EntityManipulationException
    {
        internal ErrorUpdateEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateEntity;
        }

        internal ErrorUpdateEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateEntity;
        }
    }

    class DeleteEntityException : EntityManipulationException
    {
        internal DeleteEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteEntity;
        }

        internal DeleteEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteEntity;
        }
    }

    class ErrorDeleteEntityException : EntityManipulationException
    {
        internal ErrorDeleteEntityException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteEntity;
        }

        internal ErrorDeleteEntityException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteEntity;
        }
    }

    #endregion

    #region Communication

    class CommunicationException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal CommunicationException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Communication;
        }

        internal CommunicationException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Communication;
        }
    }

    class SendEmailException : CommunicationException
    {
        internal SendEmailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SendEmail;
        }

        internal SendEmailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SendEmail;
        }
    }

    class ErrorSendEmailException : CommunicationException
    {
        internal ErrorSendEmailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorSendEmail;
        }

        internal ErrorSendEmailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorSendEmail;
        }
    }

    class SendSmsException : CommunicationException
    {
        internal SendSmsException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SendSms;
        }

        internal SendSmsException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SendSms;
        }
    }

    class ErrorSendSmsException : CommunicationException
    {
        internal ErrorSendSmsException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorSendSms;
        }

        internal ErrorSendSmsException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorSendSms;
        }
    }

    #endregion

    #region AppSettings

    class ApplicationSettingException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal ApplicationSettingException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ApplicationSetting;
        }

        internal ApplicationSettingException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ApplicationSetting;
        }
    }

    class ChangeApplicationSettingException : ApplicationSettingException
    {      
        internal ChangeApplicationSettingException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ChangeApplicationSetting;
        }

        internal ChangeApplicationSettingException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ChangeApplicationSetting;
        }
    }

    class ErrorChangeApplicationSettingException : ApplicationSettingException
    {       
        internal ErrorChangeApplicationSettingException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorChangeApplicationSetting;
        }

        internal ErrorChangeApplicationSettingException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorChangeApplicationSetting;
        }
    }

    #endregion

    #region SecuritySettings

    class SecuritySettingException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal SecuritySettingException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SecuritySetting;
        }

        internal SecuritySettingException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SecuritySetting;
        }
    }

    class CreateRoleException : SecuritySettingException
    {
        internal CreateRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateRole;
        }

        internal CreateRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateRole;
        }
    }

    class ErrorCreateRoleException : SecuritySettingException
    {
        internal ErrorCreateRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateRole;
        }

        internal ErrorCreateRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateRole;
        }
    }

    class UpdateRoleException : SecuritySettingException
    {
        internal UpdateRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateRole;
        }

        internal UpdateRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateRole;
        }
    }

    class ErrorUpdateRoleException : SecuritySettingException
    {
        internal ErrorUpdateRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateRole;
        }

        internal ErrorUpdateRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateRole;
        }
    }

    class DeleteRoleException : SecuritySettingException
    {
        internal DeleteRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteRole;
        }

        internal DeleteRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteRole;
        }
    }

    class ErrorDeleteRoleException : SecuritySettingException
    {
        internal ErrorDeleteRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteRole;
        }

        internal ErrorDeleteRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteRole;
        }
    }

    class CreateRoleDetailException : SecuritySettingException
    {
        internal CreateRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateRoleDetail;
        }

        internal CreateRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateRoleDetail;
        }
    }

    class ErrorCreateRoleDetailException : SecuritySettingException
    {
        internal ErrorCreateRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateRoleDetail;
        }

        internal ErrorCreateRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateRoleDetail;
        }
    }

    class UpdateRoleDetailException : SecuritySettingException
    {
        internal UpdateRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateRoleDetail;
        }

        internal UpdateRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateRoleDetail;
        }
    }

    class ErrorUpdateRoleDetailException : SecuritySettingException
    {
        internal ErrorUpdateRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateRoleDetail;
        }

        internal ErrorUpdateRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateRoleDetail;
        }
    }

    class DeleteRoleDetailException : SecuritySettingException
    {
        internal DeleteRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteRoleDetail;
        }

        internal DeleteRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteRoleDetail;
        }
    }

    class ErrorDeleteRoleDetailException : SecuritySettingException
    {
        internal ErrorDeleteRoleDetailException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteRoleDetail;
        }

        internal ErrorDeleteRoleDetailException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteRoleDetail;
        }
    }

    class CreateGroupException : SecuritySettingException
    {
        internal CreateGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateGroup;
        }

        internal CreateGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateGroup;
        }
    }

    class ErrorCreateGroupException : SecuritySettingException
    {
        internal ErrorCreateGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateGroup;
        }

        internal ErrorCreateGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateGroup;
        }
    }

    class UpdateGroupException : SecuritySettingException
    {
        internal UpdateGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateGroup;
        }

        internal UpdateGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateGroup;
        }
    }

    class ErrorUpdateGroupException : SecuritySettingException
    {
        internal ErrorUpdateGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateGroup;
        }

        internal ErrorUpdateGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateGroup;
        }
    }

    class DeleteGroupException : SecuritySettingException
    {
        internal DeleteGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteGroup;
        }

        internal DeleteGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteGroup;
        }
    }

    class ErrorDeleteGroupException : SecuritySettingException
    {
        internal ErrorDeleteGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteGroup;
        }

        internal ErrorDeleteGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteGroup;
        }
    }

    class CreateGroupRoleException : SecuritySettingException
    {
        internal CreateGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateGroupRole;
        }

        internal CreateGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateGroupRole;
        }
    }

    class ErrorCreateGroupRoleException : SecuritySettingException
    {
        internal ErrorCreateGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateGroupRole;
        }

        internal ErrorCreateGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateGroupRole;
        }
    }

    class UpdateGroupRoleException : SecuritySettingException
    {
        internal UpdateGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateGroupRole;
        }

        internal UpdateGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateGroupRole;
        }
    }

    class ErrorUpdateGroupRoleException : SecuritySettingException
    {
        internal ErrorUpdateGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateGroupRole;
        }

        internal ErrorUpdateGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateGroupRole;
        }
    }

    class DeleteGroupRoleException : SecuritySettingException
    {
        internal DeleteGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteGroupRole;
        }

        internal DeleteGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteGroupRole;
        }
    }

    class ErrorDeleteGroupRoleException : SecuritySettingException
    {
        internal ErrorDeleteGroupRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteGroupRole;
        }

        internal ErrorDeleteGroupRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteGroupRole;
        }
    }

    class CreateUserGroupException : SecuritySettingException
    {
        internal CreateUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUserGroup;
        }

        internal CreateUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUserGroup;
        }
    }

    class ErrorCreateUserGroupException : SecuritySettingException
    {
        internal ErrorCreateUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUserGroup;
        }

        internal ErrorCreateUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUserGroup;
        }
    }

    class UpdateUserGroupException : SecuritySettingException
    {
        internal UpdateUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateUserGroup;
        }

        internal UpdateUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateUserGroup;
        }
    }

    class ErrorUpdateUserGroupException : SecuritySettingException
    {
        internal ErrorUpdateUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateUserGroup;
        }

        internal ErrorUpdateUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateUserGroup;
        }
    }

    class DeleteUserGroupException : SecuritySettingException
    {
        internal DeleteUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUserGroup;
        }

        internal DeleteUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUserGroup;
        }
    }

    class ErrorDeleteUserGroupException : SecuritySettingException
    {
        internal ErrorDeleteUserGroupException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUserGroup;
        }

        internal ErrorDeleteUserGroupException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUserGroup;
        }
    }

    class CreateUserRoleException : SecuritySettingException
    {
        internal CreateUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUserRole;
        }

        internal CreateUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CreateUserRole;
        }
    }

    class ErrorCreateUserRoleException : SecuritySettingException
    {
        internal ErrorCreateUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUserRole;
        }

        internal ErrorCreateUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorCreateUserRole;
        }
    }

    class UpdateUserRoleException : SecuritySettingException
    {
        internal UpdateUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateUserRole;
        }

        internal UpdateUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.UpdateUserRole;
        }
    }

    class ErrorUpdateUserRoleException : SecuritySettingException
    {
        internal ErrorUpdateUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateUserRole;
        }

        internal ErrorUpdateUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorUpdateUserRole;
        }
    }

    class DeleteUserRoleException : SecuritySettingException
    {
        internal DeleteUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUserRole;
        }

        internal DeleteUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.DeleteUserRole;
        }
    }

    class ErrorDeleteUserRoleException : SecuritySettingException
    {
        internal ErrorDeleteUserRoleException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUserRole;
        }

        internal ErrorDeleteUserRoleException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.ErrorDeleteUserRole;
        }
    }

    #endregion

    #region Attacks

    class AttackException : HttpException
    {
        internal Elmah.Error ElmahError { get; set; }

        internal AttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Attack;
        }

        internal AttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.Attack;
        }
    }

    class SqliAttackException : AttackException
    {
        internal SqliAttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SqliAttack;
        }

        internal SqliAttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.SqliAttack;
        }
    }

    class XssAttackException : AttackException
    {
        internal XssAttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.XssAttack;
        }

        internal XssAttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.XssAttack;
        }
    }

    class IdorAttackException : AttackException
    {
        internal IdorAttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.IdorAttack;
        }

        internal IdorAttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.IdorAttack;
        }
    }

    class CsrfAttackException : AttackException
    {
        internal CsrfAttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CsrfAttack;
        }

        internal CsrfAttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.CsrfAttack;
        }
    }

    class OverPostingAttackException : AttackException
    {
        internal OverPostingAttackException()
            : base()
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.OverPostingAttack;
        }

        internal OverPostingAttackException(String message)
            : base(message)
        {
            this.ElmahError = new Elmah.Error(this, HttpContext.Current);
            this.ElmahError.StatusCode = (int)ExceptionCodes.OverPostingAttack;
        }
    }

    #endregion    

    enum ExceptionCodes
    {
        // Membership

        Membership = 7000, 

        CreateUser = 7001, 
        ErrorCreateUser = 7002, 
        ChangePassword = 7003, 
        ErrorChangePassword = 7004, 
        LockUser = 7005, 
        ErrorLockUser = 7006, 
        UnLockUser = 7007, 
        ErrorUnLockUser = 7008, 
        DeleteUser = 7009, 
        ErrorDeleteUser = 7010, 

        // Authentication

        Authentication = 7100, 

        Login = 7101, 
        ErrorLogin = 7102, 
        Logout = 7103, 

        // Authorization

        Authorization = 7200, 

        AuthorizedAccess = 7201, 
        UnAuthorizedAccessAttempt = 7202, 

        // Entity Manipulation

        EntityManipulation = 7300, 

        CreateEntity = 7301, 
        ErrorCreateEntity = 7302, 
        ReadEntity = 7303, 
        ErrorReadEntity = 7304, 
        UpdateEntity = 7305, 
        ErrorUpdateEntity = 7306, 
        DeleteEntity = 7307, 
        ErrorDeleteEntity = 7308, 

        // Communication

        Communication = 7400, 

        SendEmail = 7401, 
        ErrorSendEmail = 7402, 
        SendSms = 7403, 
        ErrorSendSms = 7404, 

        // Application Settings

        ApplicationSetting = 7500, 

        ChangeApplicationSetting = 7501, 
        ErrorChangeApplicationSetting = 7502, 

        // Security settings

        SecuritySetting = 7600, 

        CreateRole = 7601, 
        ErrorCreateRole = 7602, 
        UpdateRole = 7603, 
        ErrorUpdateRole = 7604, 
        DeleteRole = 7605, 
        ErrorDeleteRole = 7606, 

        CreateRoleDetail = 7607, 
        ErrorCreateRoleDetail = 7608, 
        UpdateRoleDetail = 7609, 
        ErrorUpdateRoleDetail = 7610, 
        DeleteRoleDetail = 7611, 
        ErrorDeleteRoleDetail = 7612, 

        CreateGroup = 7613, 
        ErrorCreateGroup = 7614, 
        UpdateGroup = 7615, 
        ErrorUpdateGroup = 7616, 
        DeleteGroup = 7617, 
        ErrorDeleteGroup = 7618, 

        CreateGroupRole = 7619, 
        ErrorCreateGroupRole = 7620, 
        UpdateGroupRole = 7621, 
        ErrorUpdateGroupRole = 7622, 
        DeleteGroupRole = 7623, 
        ErrorDeleteGroupRole = 7624, 

        CreateUserGroup = 7625, 
        ErrorCreateUserGroup = 7626, 
        UpdateUserGroup = 7627, 
        ErrorUpdateUserGroup = 7628, 
        DeleteUserGroup = 7629, 
        ErrorDeleteUserGroup = 7630, 

        CreateUserRole = 7631, 
        ErrorCreateUserRole = 7632, 
        UpdateUserRole = 7634, 
        ErrorUpdateUserRole = 7635, 
        DeleteUserRole = 7636, 
        ErrorDeleteUserRole = 7637, 

        // Attack

        Attack = 7700, 
        SqliAttack = 7701, 
        XssAttack = 7702, 
        IdorAttack = 7703, 
        CsrfAttack = 7704, 
        OverPostingAttack = 7705 
    }
}